package org.ccf.chamberlain;

import org.ccf.chamberlain.business.BusinessManager;
import org.ccf.chamberlain.view.DialogFactroy;

import android.app.Activity;
import android.app.Dialog;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

public class Main extends Activity
{

	public static final int DIALOG_IN = 1;
	public static final int DIALOG_OUT = 2;
	public static final int DIALOG_QUREY = 3;
	public static final int DIALOG_DETAIL = 4;
	DialogFactroy dialogFactroy = DialogFactroy.buildDialogFactroy();

	@Override
	public void onCreate(Bundle savedInstanceState)
	{
		super.onCreate(savedInstanceState);
		setContentView(R.layout.main);
		BusinessManager manager = new BusinessManager(this);
		manager.initTable();
		manager.saveNoteLog();
//		manager.queryAllCatetory();
		initButton();
		
	}

	private void initButton()
	{
		Button btn_in = (Button) findViewById(R.id.in);
		btn_in.setOnClickListener(new OnClickListener()
		{
			public void onClick(View v)
			{
				showDialog(DIALOG_IN);
			}

		});
	}

	@Override
	protected Dialog onCreateDialog(int id)
	{
		switch (id)
			{
			case DIALOG_IN:
				return dialogFactroy.buildCategoryDialog(Main.this);
			default:
				return dialogFactroy.buildCategoryDialog(Main.this);
			}
	}

}